package NPE_CONST;

import java.util.StringTokenizer;

public class Example {
    static String searchForMaxString(final String text) {
        if (text == null) return null;
        int max = 0;
        StringTokenizer tok = new StringTokenizer(text, ":");
        String found = null;
        while (tok.hasMoreTokens()) {
            String x = tok.nextToken();
            if (x.length() >= max) {
                max = x.length();
                found = x;
            }
        }
        int len = found.length();
        System.err.println(len + " -> " + found);
        return found;
    }
}
